package com.brainydroid.example.numerical_distance;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

import com.badlogic.gdx.Gdx;
import com.brainydroid.framework.Scene;


public class data2sd {
	

	public static void storedata(String[] head, float[][] data) throws IOException{
	// DO some little stats
		
		if (Gdx.files.isExternalStorageAvailable()) {
           		
		File dir = new File(Gdx.files.getExternalStoragePath()  + "/Experiment");
		dir.mkdirs();
		
		
		File file = new File(dir, "data.txt");

		FileOutputStream f = new FileOutputStream(file);
	    OutputStreamWriter out = new OutputStreamWriter(f);
	    BufferedWriter bwriter = new BufferedWriter(out);

	

bwriter.write("number");bwriter.write('\t');
bwriter.write("answer");bwriter.write('\t');  
bwriter.write("delay");bwriter.write('\t');    
bwriter.newLine();  

for (int j=0;  j<data.length;  j++) {
	
		bwriter.write(String.valueOf(data[0][j]));  bwriter.write('\t');
		bwriter.write(String.valueOf(data[1][j]));  bwriter.write('\t');
		bwriter.write(String.valueOf(data[2][j]));  bwriter.write('\t');
		bwriter.newLine();

}

bwriter.close(); out.close(); f.close();

 }
	}
	
	
}
